import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const VisibilityMeta: IPublicTypeComponentMetadata = {
  componentName: 'Visibility',
  title: '能见度',
  category: '信息展示',
  group: '气象防灾',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'Visibility',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '背景颜色'
    },
    {
      name: 'backgroundOpacity',
      propType: 'number',
      description: '背景透明度'
    },
    {
      name: 'label',
      propType: 'string',
      description: '标签文字'
    },
    {
      name: 'value',
      propType: 'string',
      description: '能见度数值'
    },
    {
      name: 'unit',
      propType: 'string',
      description: '单位'
    },
    {
      name: 'labelColor',
      propType: 'string',
      description: '标签文字颜色'
    },
    {
      name: 'valueColor',
      propType: 'string',
      description: '数值颜色'
    },
    {
      name: 'unitColor',
      propType: 'string',
      description: '单位颜色'
    },
    {
      name: 'showGradientText',
      propType: 'bool',
      description: '显示渐变文字'
    },
    {
      name: 'showLabelShadow',
      propType: 'bool',
      description: '显示标签阴影'
    },
    {
      name: 'showValueShadow',
      propType: 'bool',
      description: '显示数值阴影'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onLabelClick',
      propType: 'func',
      description: '标签点击事件'
    },
    {
      name: 'onValueClick',
      propType: 'func',
      description: '数值点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'label',
        title: { label: { type: 'i18n', 'en-US': 'label', 'zh-CN': '标签文字' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '能见度' }
      },
      {
        name: 'value',
        title: { label: { type: 'i18n', 'en-US': 'value', 'zh-CN': '能见度数值' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '6907' }
      },
      {
        name: 'unit',
        title: { label: { type: 'i18n', 'en-US': 'unit', 'zh-CN': '单位' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'm' }
      },
      {
        name: 'backgroundColor',
        title: { label: { type: 'i18n', 'en-US': 'backgroundColor', 'zh-CN': '背景颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(0,0,0,0.27)' }
      },
      {
        name: 'labelColor',
        title: { label: { type: 'i18n', 'en-US': 'labelColor', 'zh-CN': '标签文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
      },
      {
        name: 'valueColor',
        title: { label: { type: 'i18n', 'en-US': 'valueColor', 'zh-CN': '数值颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#1AD7FF' }
      },
      {
        name: 'unitColor',
        title: { label: { type: 'i18n', 'en-US': 'unitColor', 'zh-CN': '单位颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#1AD7FF' }
      },
      {
        name: 'showGradientText',
        title: { label: { type: 'i18n', 'en-US': 'showGradientText', 'zh-CN': '显示渐变文字' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      },
      {
        name: 'showLabelShadow',
        title: { label: { type: 'i18n', 'en-US': 'showLabelShadow', 'zh-CN': '显示标签阴影' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      },
      {
        name: 'showValueShadow',
        title: { label: { type: 'i18n', 'en-US': 'showValueShadow', 'zh-CN': '显示数值阴影' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '能见度',
    screenshot: '',
    schema: {
      componentName: 'Visibility',
      props: {
        width: 194,
        height: 48,
        backgroundColor: 'rgba(0,0,0,0.27)',
        backgroundOpacity: 1,
        label: '能见度',
        value: '6907',
        unit: 'm',
        labelColor: '#FFFFFF',
        valueColor: '#1AD7FF',
        unitColor: '#1AD7FF',
        showGradientText: true,
        gradientColors: ['#FFFFFF', '#81C6FF'],
        showLabelShadow: true,
        labelShadow: {
          offsetX: 0,
          offsetY: 2,
          blur: 4,
          spread: 0,
          color: 'rgba(0,0,0,0.5)'
        },
        showValueShadow: true,
        valueShadow: {
          offsetX: 0,
          offsetY: 0,
          blur: 5,
          spread: 1,
          color: '#017DE7'
        },
        fontSize: {
          label: 18,
          value: 20,
          unit: 20
        },
        fontWeight: {
          label: 500,
          value: 'bold',
          unit: 'semibold'
        },
        letterSpacing: {
          label: '1px',
          value: '0px',
          unit: '0px'
        },
        theme: 'dark'
      }
    }
  }
];

export default {
  ...VisibilityMeta,
  snippets
}; 